package com.telecom.controller;

import com.alibaba.fastjson.JSONObject;
import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
import com.telecom.common.HttpsUtils;

import java.util.HashMap;
import java.util.Map;

public class ITest2 {
    public static void main(String[] args) throws ClientException {


        Map<String,Object> map = new HashMap<>();
        //{"typeCode":"01;0;8;7"}
        map.put("typeCode","01;0;8;7");
        map.put("showStatus",true);
        map.put("hasCheckBox",false);
        map.put("hideEmptyOrg",true);
        map.put("searchKey",455);
        map.put("allowRFID",false);
        map.put("deviceGenre",0);
        map.put("filterDeviceModel",25);
//        GeneralResponse generalResponse = HttpsUtils.iRequest("/evo-apigw/evo-accesscontrol/1.0.0/resource/tree/search", Method.POST,map,"bearer 2:32154676-7954-4f1b-a4b3-848ce3246006");
        /**
         * 1、请求地址是统一网关入口，以 /evo-apigw 开头
         * 2、方法参见 @see com.dahuatech.hutool.http.Method
         */
        GeneralResponse generalResponse = HttpsUtils.iRequest("/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/timeQuantum/1",Method.GET,map);
//        GeneralRequest generalRequest = new GeneralRequest("/evo-apigw/evo-accesscontrol/1.0.0/resource/tree/search", Method.POST);
        // set http post body
//        generalRequest.body(JSONUtil.toJsonStr(map));
////        // set http get method param 例如?name=xiao&mobile=1xxx
////        generalRequest.form("key", "value");
////        // set header
////        generalRequest.header("Authorization", "bearer 2:32154676-7954-4f1b-a4b3-848ce3246006");
//        // 发起请求处理应答
//        GeneralResponse generalResponse =iClient.doAction(generalRequest, generalRequest.getResponseClass());
        System.out.println(generalResponse.getResult());
    }
}
